// pages/routeList/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    routeList: ['/assets/image/search/img_1.png', '/assets/image/search/img_2.png', '/assets/image/search/img_3.png', '/assets/image/search/img_4.png', '/assets/image/search/img_1.png', '/assets/image/search/img_2.png', '/assets/image/search/img_3.png', '/assets/image/search/img_4.png']
  },
  initPartner(arr, size) {
    // 遍历获取
    var oddArr = []; // 奇数数组
    var evenArr = []; // 偶数数组
    for (let i = 0; i < arr.length; i++) {
      // 偶数下标

      if (i % 2 == 0) {
        oddArr.push(arr[i])
      } else {
        // 奇数下标
        evenArr.push(arr[i])
      }
    }
    let _arr = [oddArr, evenArr]

    return _arr
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      routeList: this.initPartner(this.data.routeList, 2)
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})